﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PeToText
{
    partial class SourceEmitter
    {
        public override void Visit(Microsoft.Cci.IForStatement forStatement)
        {
            PrintString("for (");
            Visit(forStatement.InitStatements);
            PrintString(";");
            Visit(forStatement.Condition);
            PrintString(";");
            Visit(forStatement.IncrementStatements);
            PrintToken(CSharpSourceEmitter.CSharpToken.RightParenthesis);
            Visit(forStatement.Body);
        }

        public override void Visit(Microsoft.Cci.IForEachStatement forEachStatement)
        {
            PrintString("foreach");
            PrintToken(CSharpSourceEmitter.CSharpToken.LeftParenthesis);
            PrintTypeReference(forEachStatement.Variable.Type);
            PrintToken(CSharpSourceEmitter.CSharpToken.Space);
            PrintLocalName(forEachStatement.Variable);
            PrintToken(CSharpSourceEmitter.CSharpToken.Space);
            PrintToken(CSharpSourceEmitter.CSharpToken.In);
            Visit(forEachStatement.Collection);
            PrintToken(CSharpSourceEmitter.CSharpToken.RightParenthesis);
            PrintToken(CSharpSourceEmitter.CSharpToken.Space);
            Visit(forEachStatement.Body);
        }
    }
}